<template>
  <div class="pdf-viewer-page">

    <no-ssr>
      <pdf
        v-for="i in numPages"
        :key="i"
        :src="src"
        :page="i"
        style="display: inline-block; width: 25%"
      ></pdf>
    </no-ssr>
  </div>
</template>

<script>
  var pdf;
  if (process.browser) {
    pdf = require('vue-pdf').default
    var loadingTask = pdf.createLoadingTask('http://txh.lwt.com/api/gzns/pdf/download/file/1');
  }

  export default {
    components: {
      pdf
    },
    data() {
      return {
        src: loadingTask,
        numPages: undefined,
      }
    },
    mounted() {

      this.src.promise.then(pdf => {

        this.numPages = pdf.numPages;
      });
    }
  }
</script>

<style lang="less" scoped>

</style>
